package edu.gxnu.cetcdemo.controller;

import edu.gxnu.cetcdemo.pojo.TCheck;
import edu.gxnu.cetcdemo.service.TCheckService;
import edu.gxnu.cetcdemo.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/check")
public class TCheckController {
    @Autowired
    private TCheckService tCheckService;

    @ApiOperation("浏览检查表接口")
    @GetMapping("")
    public Result queryTCheck(){
        return tCheckService.queryTCheck();
    }

    @ApiOperation("添加检查表信息接口")
    @PostMapping("")
    public Result addTCheck(@RequestBody TCheck tCheck){
        return tCheckService.addTCheck(tCheck);
    }

    @ApiOperation("更新检查表信息接口")
    @PutMapping("")
    public Result updateTCheck(@RequestBody TCheck tCheck){
        return tCheckService.updateTCheck(tCheck);
    }

    @ApiOperation("删除检查表信息接口")
    @DeleteMapping("/{check_id}")
    public Result delTCheck(@PathVariable long check_id){
        return tCheckService.delTCheck(check_id);
    }
}
